Skip to content

fix(flows): count ID-less responses when resuming parallel calls - #7388

Closed
SoroushRF wants to merge 1 commit into
google:mainfrom
SoroushRF:fix/resume-idless-response-count
Closed

SoroushRF wants to merge 1 commit into
google:mainfrom
SoroushRF:fix/resume-idless-response-count

Conversation

@SoroushRF

Copy link
Copy Markdown
Contributor

Link to Issue or Description of Change

Problem:

When a restored resumable invocation contains parallel calls to the same tool, one ID-less response currently marks all calls with that name as answered. The flow can therefore continue without executing an unmatched sibling. This is separate from the original #7108 fix, which already landed.

Solution:

Count ID-less responses per tool name. Match explicit response IDs first, then consume one name-only response per remaining call in original call order. Filter the replay event by content part so calls without IDs can also be distinguished by their position. Preserve non-call parts and stored events.

The existing agent-authored batch-completion guard, pause/LRO/HITL decisions, branch filtering, and author provenance checks remain unchanged. The helper docstring documents the matching rule; no public API or configuration changes are introduced.

Name-only responses cannot identify which same-name arguments actually ran. Call order is a deterministic compatibility fallback, not an exactly-once guarantee. Normal ADK responses retain call IDs; this fix concerns restored or caller-supplied histories with ID-less responses.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • Full supported-version unit suites pass in hosted tox on the reviewed commit.

Validated commit d3fc9d13d39137351be2b25763239c8c5d560389:

  • Both affected files locally on Linux/WSL, Python 3.13.15: 147 passed.
  • Complete hosted tox matrix, using isolated environments and pytest tests/unittests -n 2 --junitxml=test-results.xml:
Python Passed Skipped Xfailed Xpassed
3.10.21 17,399 87 25 2
3.11.16 17,408 86 25 2
3.12.14 17,399 87 25 2
3.13.15 17,399 87 25 2
3.14.7 17,399 87 25 2

All five jobs succeeded with zero JUnit failures/errors. The logs include warnings, including aiosqlite worker-thread shutdown warnings in session tests. The validation workflow and generated dependency lock are on a separate fork branch, outside this three-file PR.

  • All 14 pre-commit hooks passed in the native Linux checkout. git diff --check passed. Strict mypy reports 809 diagnostics on both pristine main and the patch, with zero new diagnostics after comparing diagnostic multiplicity with line numbers normalized.

The tests cover response multiplicity, sufficient/extra responses, explicit-ID priority in both response orders, duplicate/unmatched explicit responses, missing call IDs, content order, immutable history, and the batch-completion guard. Flow regressions verify exactly which tools execute and which response IDs are emitted.

Manual End-to-End (E2E) Tests:

Save the offline Runner reproduction from #7387 as resume_smoke.py, install this checkout (uv sync), and run uv run python resume_smoke.py. It restores ask/c1 and ask/c2 calls with different arguments and one user-authored ID-less ask response, then resumes the saved invocation. The Runner, in-memory session service, and counting tools are real; the model boundary is a deterministic local implementation. No external model requests or paid services are used. The before result below was reproduced on pristine main e94c2e72; the after result uses the reviewed commit.

Before:
Tool executions: []; response IDs: []
AssertionError: []

After:
Tool executions: [1]; response IDs: ['c2']
PASS: real Runner resumes only c2; no external model calls

Built the wheel and source distribution with uv build. Installed the wheel in a clean environment and reran the same reproduction from outside the checkout: passed, with imports coming from the wheel installation.

Checklist

  • I have read CONTRIBUTING.md.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective.
  • New and existing unit tests pass in the full supported-version hosted tox matrix with my changes.
  • I have manually tested my changes end-to-end (offline Runner reproduction above).
  • Any dependent changes have been merged and published in downstream modules. N/A: no dependent changes.

Additional context

Prepared with AI assistance under contributor direction. The original edge case and diagnosis are credited to the linked issue discussion. A separate source audit found no actionable defects in the patch. No downstream documentation changes are needed: this correction changes no public API, configuration, or documented setup workflow.

copybara-service Bot pushed a commit that referenced this pull request Oct 5, 2026
@adk-bot

adk-bot commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Thank you @SoroushRF for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 531f410.

Closing this PR as the changes are now in the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged [Status] This PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ID-less responses suppress unanswered same-name calls when resuming parallel tools

3 participants